<template>
  <div class="nav-bar">
    <div class="left" @click="goBack">
      <slot name="left">
        <img src="./images/left.png" alt="" />
      </slot>
    </div>
    <div class="center"><slot>EWShop</slot></div>
    <div class="right"><slot name="right"></slot></div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
export default {
  setup(props) {
    const router = useRouter();

    const goBack = () => {
      router.go(-1);
    };

    return {
      goBack,
    };
  },
};
</script>

<style lang="scss" scoped>
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9;
  display: flex;
  height: 46px;
  line-height: 46px;
  color: #ffffff;
  background-color: var(--color-tint);
  box-shadow: 0 2px 0px rgba(100, 100, 100, 0.1);
  .left,
  .right {
    width: 60px;
  }
  .center {
    flex: 1;
  }
  .left img {
    width: 46px;
    padding: 12px;
  }
}
</style>
